#include "gl2_setup_view.h"

void Update(float deltaTime)
{
	Game::GetInstance()->Update(deltaTime);
}

void Draw()
{
	Game::GetInstance()->Draw();
}

void Key(unsigned char key, bool status)
{
	Game::GetInstance()->Key(key, status);
}

void Selected()
{
	return Game::GetInstance()->Selected();
}

bool setupGraphics(int w, int h)
{
	LOGI("%s","Setup Graphics\n");
	IDevice::SetInstance(new DeviceAndroid(0,0,w,h));

	LOGI("%s","Register Update Function\n");
	IDevice::GetInstance()->RegisterUpdateFunc(Update);

	LOGI("%s","Register Draw Function\n");
	IDevice::GetInstance()->RegisterDrawFunc(Draw);

	LOGI("%s","Register Selected Function\n");
	IDevice::GetInstance()->RegisterSelectedFunc(Selected);

	LOGI("%s","Game Initializa Data\n");
	Game::GetInstance()->Init();

	LOGI("%s","End Setup Graphics\n");
}

void renderFrame()
{
	IDevice::GetInstance()->Run();
}

void destroyFrame()
{
	IDevice::DestroyInstance();
	Game::GetInstance()->Destroy();
	Game::DestroyInstance();
}
